package audivolv;

/** This is a "virtual machine" that all execution must start from.
Use it to execute networks of nodes, evolve code, connect to internet,
start or stop sound, save and load files, change options in a GUI, etc.
<br><br>
This class only runs code that returns quickly.
Any code that takes a long time to run must be in many parts
so this class can call them one at a time.
<br><br>
Any "global" vars are stored here,
including an array of hard-coded and evolved functions.
<br><br>
The design of Audivolv is intended to be simple,
fast enough to synthesize audio in realtime
at the granularity of 44100 function calls per second for 44 khz audio,
flexible enough to possibly evolve an artificial-intelligence
thats more skilled at creating music than the average Human,
and limited enough that evolved code will never crash any software.
<br><br> 
For example, nodes in a network are Object arrays which contain Object arrays
recursively and allow cycles. Some of the Objects are double arrays,
which are the "weights" of nodes. Using arrays instead of lists avoids
millions of set/get function calls per second.
Using arrays instead of creating specific classes for nodes
results in simpler evolved code to use the nodes.
*/
public class AudivolvInterpreter{
	
	private Object globalArray[] = new Object[1000];
	
	//There are a few tasks, which should each have Thread(s), in this order of priority
	//1. Play sound, get mouse input, and optionally microphone and other device inputs.
	//2. React to mouse (and any optional inputs) by changing the sound.
	//3. Find and communicate with other Audivolv softwares on the internet.
	//4. Save and load nodes/networks/functions from hard-drive.
	//5. Do slower artificial intelligence with nodes/networks and audio measure functions,
	//which includes running the measure functions on recorded audio.
	
	/** does 1 more cycle in the network,
	which affects at most 1 node and its childs.
	*/
	public void netExec(Object net[]){
		//How to define a net?
	}

}